#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define rep(i, a, b) for (int i = (a); i <= (b); i++)
#define per(i, a, b) for (int i = (a); i >= (b); i--)
#define endl '\n'
const int N = 2e5 + 5;
const int INF = 1e5;

int n, m;
struct Node {
  int x, y;
} a[205];
int d[405], num;
int cnt[405][405];
int f[405][205], b[405][205];
int mx[405][405];
int calc(int i, int j, int x, int y) {
  if (f[i - 1][x] < 0 || b[j + 1][y] < 0) return -INF;
  return min(x + y + cnt[i][j], f[i - 1][x] + b[j + 1][y]);
}
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> n;
  rep(i, 1, n) {
    int x, y;
    cin >> x >> y;
    y += x - 1;
    a[i].x = x, a[i].y = y;
    d[i] = x, d[i + n] = y;
  }
  sort(d + 1, d + n * 2 + 1);
  num = unique(d + 1, d + n * 2 + 1) - d - 1;
  rep(i, 1, n) {
    a[i].x = lower_bound(d + 1, d + num + 1, a[i].x) - d;
    a[i].y = lower_bound(d + 1, d + num + 1, a[i].y) - d;
  }
  rep(i, 1, num) rep(j, i + 1, num) {
    rep(k, 1, n) if (a[k].x >= i && a[k].y <= j) cnt[i][j]++;
  }
  rep(i, 0, num + 1) rep(j, 0, n) f[i][j] = b[i][j] = -INF;
  f[0][0] = 0;
  rep(i, 1, num) rep(j, 0, n) {
    rep(k, 0, i - 1) {
      f[i][j] = max(f[i][j], f[k][j] + cnt[k + 1][i]);
      f[i][j] = max(f[i][j], f[k][max(0, j - cnt[k + 1][i])]);
    }
  }
  b[num + 1][0] = 0;
  per(i, num, 1) rep(j, 0, n) {
    per(k, num + 1, i + 1) {
      b[i][j] = max(b[i][j], b[k][j] + cnt[i][k - 1]);
      b[i][j] = max(b[i][j], b[k][max(0, j - cnt[i][k - 1])]);
    }
  }
  rep(i, 1, num) rep(j, i, num) {
    if (!cnt[i][j]) continue;
    int y = cnt[j + 1][num];
    rep(x, 0, cnt[1][i - 1]) {
      int p = calc(i, j, x, y);
      while (y) {
        int t = calc(i, j, x, y - 1);
        if (t >= p) {
          y--, p = t;
        } else
          break;
      }
      mx[i][j] = max(mx[i][j], p);
    }
  }
  int ans = 0;
  rep(i, 1, n) ans = max(ans, min(i, f[num][i]));
  cout << ans << endl;
  rep(k, 1, n) {
    ans = 0;
    rep(i, 1, num) rep(j, i + 1, num) {
      if (a[k].x < i || a[k].y > j) continue;
      ans = max(ans, mx[i][j]);
    }
    cout << ans << endl;
  }
  return 0;
}